import _regeneratorRuntime from "@babel/runtime/regenerator";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

/**
 * TenantInitHandleConfig - 租户初始化处理配置
 * @date: 2019/6/18

 */
import request from 'utils/request';
import { CPAAS_IAM } from 'utils/config';
import { parseParameters } from 'utils/utils';
/**
 * 查询租户初始化处理器配置列表
 * @async
 * @function queryConfig
 * @param {*} params - 查询参数
 */

export function queryConfig(_x) {
  return _queryConfig.apply(this, arguments);
}
/**
 * 格式化查询租户初始化处理器配置
 * @async
 * @function queryFormatConfig
 */

function _queryConfig() {
  _queryConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(params) {
    var param;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            param = parseParameters(params);
            return _context.abrupt("return", request("".concat(CPAAS_IAM, "/v1/tenant-init-configs/list"), {
              method: 'GET',
              query: _objectSpread({}, param)
            }));

          case 2:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _queryConfig.apply(this, arguments);
}

export function queryFormatConfig() {
  return _queryFormatConfig.apply(this, arguments);
}

function _queryFormatConfig() {
  _queryFormatConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
    return _regeneratorRuntime.wrap(function _callee2$(_context2) {
      while (1) {
        switch (_context2.prev = _context2.next) {
          case 0:
            return _context2.abrupt("return", request("".concat(CPAAS_IAM, "/v1/tenant-init-configs/map"), {
              method: 'GET'
            }));

          case 1:
          case "end":
            return _context2.stop();
        }
      }
    }, _callee2);
  }));
  return _queryFormatConfig.apply(this, arguments);
}